{% extends "sidebar2base.html" %}

{% block content %}
<div style="font-size:30;"><b>Updates</b></div>
{% if profileOwner %}
	<small style="font-size:10;">
	Text: just write what you want<br/>
	Video: Post a <a href="http://www.youtube.com/" target="_blank">Youtube</a> link<br/>
	Audio: Post a <a href="http://www.soundcloud.com/" target="_blank">Soundcloud</a> embed code (choose 'share' then copy the embed code, deselect "user html5 widget")<br/>
	</small>
{% endif %}

<br/>
<small>
<a href="/">All</a>	|	
{% if currentUser.category == "teacher" %}
	<a href="/myprofile/other/{{ currentUser.abstract_user.id }}/">Lessons</a>	|
{% endif %}
{% if currentUser.category == "student" %}
	<a href="/myprofile/other/{{ currentUser.abstract_user.id }}/">My Jams</a>	|
{% endif %}
{% if currentUser.category == "institute" %}
	<a href="/myprofile/other/{{ currentUser.abstract_user.id }}/">Our Talent</a>	|
{% endif %}
<a href="/myprofile/fav/{{ currentUser.abstract_user.id }}/">Favorites</a>
<br/><br/>
</small>

{% if profileOwner %}
	<form action="/myprofile/postUpdate/" method="POST">{% csrf_token %}
		<input type="text" name="entry" style="height:30;width:100%"/>
		<input type="image" src="{{ STATIC_URL }}images/post_btn.jpg" alt='Submit Form' style="float:right;"><br/><br/>
		
		<input type="checkbox" name="other" value="on" />
		{% if currentUser.category == "teacher" %}Lesson{% endif %}
	
		{% if currentUser.category == "student" %}Jam{% endif %}
	
		{% if currentUser.category == "institute" %}Talent{% endif %}
	
		<input type="checkbox" name="fav" value="on" />Favorite
		
		<br /><br /><br />
	</form>
{% endif %}

{% for update, count in updates %}
	
	{%  if update.video_id %}
		<iframe width="560" height="315" src="http://www.youtube.com/embed/{{ update.video_id }}" frameborder="0" allowfullscreen></iframe>
		<br/></br>
		<small style="float:right">
			{% if count > 0 %}<a href="/myprofile/mediaReviews/{{ update.id }}/">view {{ count }} reviews</a> - {% endif %}
			{% if not profileOwner and areFriends %}
				<a href="/myprofile/review/{{ update.id }}/{{ currentUser.abstract_user.id }}/">review</a>
			{% endif %}
		</small>
	{% endif %}

	{% if update.content %}
		{{ update.content|safe }}
		<br/>
	{% endif %}

	{% if update.mp3_url %}
		{{ update.mp3_name }}
		<iframe height="100" width="100%" frameborder="0" src={{ update.mp3_url }}> 
		</iframe> 
		<br/>
		{% if count > 0 %}<small><a href="/myprofile/mediaReviews/{{ update.id }}/">view {{ count }} reviews</a> - </small>{% endif %}
		{% if not profileOwner and areFriends %}
			<small><a href="/myprofile/review/{{ update.id }}/{{ currentUser.abstract_user.id }}/">review</a></small>
		{% endif %}
	{% endif %}
	
	{% if profileOwner %}
		<small style="font-size:10;font-style:italic;float:right"><a href="/myprofile/deleteUpdate/{{ update.id }}/">delete</a></small>
	{% endif %}
	
	
	<br/><br/>
{% empty %}
	{% if profileOwner %}
		You don't have any updates yet. Why don't you post some updates, you can add videos, audio, and text
	{% else %}
		{{ currentUser.abstract_user }} doesn't have any updates yet.
	{% endif %}
{% endfor %}
{% if more_updates_available %}
<small><a href="/myprofile/viewMoreUpdates/{{ updates_type }}/{{ currentUser.abstract_user.id }}/{{ updates|length }}">view more updates</a></small>
<br/><br/>
{% endif %}
{% endblock %}
